<!DOCTYPE html>
<html>
<head>
<#include "/common/freemarker/include_css.ftl">
<title>用户编辑</title>
</head>


<body>
	<div class="panel panel-default">
	   <div class="panel-heading">
	       <div class="panel-title">用户编辑</div>
	   </div>
	   <div clas="panel-body">
	      <div class="row">
	           <div class="col-md-2 col-sm-2">
	               <br>
	               <form id="contentForm" class="form-horizontal"  onsubmit="return false;" method="POST"  >
	                	<input type="hidden" name="uuid" value='<#if obj?exists>${obj.uuid?if_exists}</#if>' />
						 
 
	                    <#if obj?exists>
		                    <div class="form-group">
		                    	<label class="col-md-1 col-sm-1 control-label">新密码<font color="red">  </font></label>
		                        <div class="col-md-1 col-sm-1">
									<input type="password"  class="input-sm form-control  password" id="passwd" name="passwd" value=''      />
		                    	</div>              	
		                    </div>
	                   		 <div class="form-group">
		                    	<label class="col-md-1 col-sm-1 control-label">重复新密码<font color="red">  </font></label>
		                        <div class="col-md-1 col-sm-1">
									<input type="password"  class="input-sm form-control  password" id="confirmPasswd" name="confirmPasswd" value=''      />
		                    	</div>              	
		                    </div>		                    
	                    </#if>
	                    
	                                                      
	                    <div class="form-group">
	                    	<div class="col-md-offset-1 col-md-1 col-sm-offset-1 col-sm-1">
	                    		<input type="button" class="btn btn-sm  btn-primary" id="submitBtn" value="保 存"/>
	                    		<input type="button" class="btn btn-sm btn-default" value="关 闭" onclick="javascript:art.dialog.close();"/>
	                    	</div>
	                    </div>
	              </form>
	        </div>
	    </div>
	</div>
	<#--  公共js -->
	<#include "/common/freemarker/include_js.ftl">
 
	 
  
	<script>
	    
		 $("#submitBtn").click(function() {
			  if(!$("#contentForm").valid()){
			    	 return;
			  }
			  
			  if ($("#confirmPasswd").val()!=$("#passwd").val() ){
			  	 alert("两次密码不一致，请重新输入");
			  	 return false;
			  }
			  <#--  
		      $("#submitBtn").attr("value", "提交中..."); 
		      $('#contentForm').find(":button").attr("disabled", true);
		      $("#contentForm").submit(); //提交表单，如果不写，即便通过表单也不会自动提交 
			  -->	
			   $.ajax({
			         type:"POST",
			         url: "<@context/>ea/user/sumbitPwd.do",
			         data: $('#contentForm').serialize(),
			         dataType: 'json',
			         async: false,
			         cache: false,
			         success: function(json){
			        	if (json.status!="success"){
			        		alert(json.message);
		 
			        	}else{
			        		alert("修改成功");
			        		art.dialog.close();
			        	}
			         } ,
			         error:function(err){
			         	alert("出错啦");
			         }
			  });  

		})
 
	</script>
 
</body>
</html>

 

